package com.berchen.数据结构.二叉树.赫夫曼编解码;

/**
 * 赫夫曼编码解码 需要用到的赫夫曼树的节点
 */
public class HuffmanNode implements Comparable<HuffmanNode>{
    Byte date;  // 保存的就是字符
    int weight; // 权重 就是字符出现的次数
    HuffmanNode left;
    HuffmanNode right;

    public HuffmanNode(Byte date, int weight) {
        this.date = date;
        this.weight = weight;
    }

    @Override
    public String toString() {
        return "HuffmanNode{" +
                "date=" + date +
                ", weight=" + weight +
                '}';
    }

    @Override
    public int compareTo(HuffmanNode o) {
        return this.weight-o.weight;
    }
}
